package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.lmx.repoDomain.tmodel.business.User;

import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

// 老人活动方案表
@JsonApiResource(type = "customeractivityproject")
@Table(name = "tnb_customer_activity_project")
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CustomerActivityProject extends BaseEntity {

	private Integer createDateTime;// 创建时间
	
	private CustomerActivityPackage acitivityPackage;// 套餐项目ID
	
	private String name;// 备注
	
	private Customer customer; // 创建人
	
	private User createUser; // 创建人

	private String updateFlag;
	
	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Transient
	public String getUpdateFlag() {
		return updateFlag;
	}

	public void setUpdateFlag(String updateFlag) {
		this.updateFlag = updateFlag;
	}
	@Column(name = "name")
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "customer_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "createuser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}
	
	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "packageID", foreignKey = @ForeignKey(name = "null"))
	public CustomerActivityPackage getAcitivityPackage() {
		return acitivityPackage;
	}

	public void setAcitivityPackage(CustomerActivityPackage acitivityPackage) {
		this.acitivityPackage = acitivityPackage;
	}
}
